﻿
Namespace DAL

    Public Class DAL_ChequeoRecalculoDV

        Shared Function traerTabla(ByVal ptabla As String) As DataSet
            Dim comm As String = ""

            Select Case ptabla
                Case "bitacora"
                    comm = "SELECT id_bitacora, id_usuario, fecha_log, descripcion, criticidad, borrado, dvh FROM bitacora"

                Case "familia_patente"
                    comm = "SELECT id_familia, id_patente, dvh FROM familia_patente"

                Case "usuario_patente"
                    comm = "SELECT id_usuario, id_patente, tipo, dvh FROM usuario_patente"

            End Select

            Return Helper_DAL.ExecuteDataset(comm)

        End Function

        Shared Sub setearDVH(ByVal ptabla As String, ByVal pid1 As Integer, ByVal pid2 As Integer, ByVal pdvh As Integer)
            Dim comm As String = ""

            Select Case ptabla
                Case "bitacora"
                    comm = "UPDATE bitacora SET dvh= " & pdvh & " WHERE id_bitacora=" & pid1

                Case "familia_patente"
                    comm = "UPDATE familia_patente SET dvh= " & pdvh & " WHERE id_familia =" & pid1 & " AND id_patente= " & pid2

                Case "usuario_patente"
                    comm = "UPDATE usuario_patente SET dvh= " & pdvh & " WHERE id_usuario=" & pid1 & " AND id_patente= " & pid2
            End Select

            Helper_DAL.ExecuteDataset(comm)

        End Sub



    End Class

End Namespace